package com.jiayang.hhotel.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.jiayang.hhotel.R;
import com.jiayang.hhotel.ui.LoginActivity;
import com.jiayang.hhotel.ui.MessageSettingActivity;
import com.jiayang.hhotel.ui.PersonInfoActivity;
import com.jiayang.hhotel.ui.ReSetPsdActivity;
import com.jiayang.hhotel.view.CircleImageView;

import cn.droidlover.xdroidmvp.mvp.XLazyFragment;

/**
 * Created by Administrator on 2017/5/19 0019.
 * 我的页面
 */

public class WoDeFragment extends XLazyFragment implements View.OnClickListener {

    private CircleImageView headImg;//头像
    private Button loginOrRegister;//登录或注册按钮
    private TextView cacheSize;//缓存大小
    private RelativeLayout psdSet,info,message,cache,about;//密码设置/个人信息/消息提醒/清空缓存/关于

    @Override
    public void initData(Bundle savedInstanceState) {
        headImg= (CircleImageView) getRootView().findViewById(R.id.head_iv);
        loginOrRegister= (Button) getRootView().findViewById(R.id.bt_login);
        cacheSize= (TextView) getRootView().findViewById(R.id.tv_cache_size);
        psdSet= (RelativeLayout) getRootView().findViewById(R.id.rl_psd);
        info= (RelativeLayout) getRootView().findViewById(R.id.rl_person_info);
        message= (RelativeLayout) getRootView().findViewById(R.id.rl_message_remind);
        cache= (RelativeLayout) getRootView().findViewById(R.id.rl_clean_cache);
        about= (RelativeLayout) getRootView().findViewById(R.id.rl_about);

        loginOrRegister.setOnClickListener(this);
        psdSet.setOnClickListener(this);
        info.setOnClickListener(this);
        message.setOnClickListener(this);
        cache.setOnClickListener(this);
        about.setOnClickListener(this);
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_wode;
    }

    @Override
    public Object newP() {
        return null;
    }

    private Intent intent;
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.bt_login://登录或注册
                intent=new Intent(getActivity(),LoginActivity.class);
                startActivity(intent);
                break;
            case R.id.rl_psd://密码设置
                intent=new Intent(getActivity(),ReSetPsdActivity.class);
                startActivity(intent);
                break;
            case R.id.rl_person_info://个人信息
                intent=new Intent(getActivity(),PersonInfoActivity.class);
                startActivity(intent);
                break;
            case R.id.rl_message_remind://消息提醒
                intent=new Intent(getActivity(),MessageSettingActivity.class);
                startActivity(intent);
                break;
            case R.id.rl_clean_cache://清空缓存
                break;
            case R.id.rl_about://关于
                break;
        }
    }
}
